
import admin.jms.resources.AdminJMSResources as adminJMSLocal
#import admin.sib.resources.AdminSIBResources as adminSIBLocal
import admin.servers.AdminServers as serverAdmin
import admin.datasources.resources.AdminDSResources as adminDS
#import admin.security.JAAS.AdminJAASAuthData as adminJaas
import ReadPropertiesName as readProperties 

nodeContext = '/Node:BCORHERNANDEZM_PORNode11'

jdbcJDBCProviders = readProperties.mainJdbcProviderArray()


jdbcDatasources = readProperties.mainJdbcDataSourceArray()


listenerPorts = readProperties.mainlistenerPortArray()


MQQCFResources = readProperties.mainMQQCFResourcesArray()
 

MQQueueResources = readProperties.mainMQQueueResourcesArray()
   

NameSpaceBindings = readProperties.mainNameSpaceBindingArray()

#JDBC Providers
for jdbcProvider in jdbcJDBCProviders:
    adminDS.createDB2JDBCProvider(jdbcProvider[0], jdbcProvider[1], jdbcProvider[2])

#JDBC Datasources
for jdbcDatasource in jdbcDatasources:
    adminDS.createDB2Datasource(jdbcDatasource[0], jdbcDatasource[1], jdbcDatasource[2], jdbcDatasource[3], jdbcDatasource[4], jdbcDatasource[5], jdbcDatasource[6], jdbcDatasource[7], jdbcDatasource[8], jdbcDatasource[9])

#ListenerPorts
for listenerPort in listenerPorts:
    serverAdmin.createListenerPort(listenerPort[0], listenerPort[1], listenerPort[2], listenerPort[3], listenerPort[4], listenerPort[5], listenerPort[6], listenerPort[7], listenerPort[8])

#MQQCFs
for mQQCFBindingResource in MQQCFResources:
    adminJMSLocal.createBindingsMQQueueConnectionFactory(mQQCFBindingResource[0], mQQCFBindingResource[1], mQQCFBindingResource[2], mQQCFBindingResource[3], mQQCFBindingResource[4], mQQCFBindingResource[5])

#for mQQCFClientResource in MQQCFResources[1]:
#    adminJMSLocal.createClientMQQueueConnectionFactory(mQQCFClientResource[0], mQQCFClientResource[1], mQQCFClientResource[2], mQQCFClientResource[3], mQQCFClientResource[4], mQQCFClientResource[5], mQQCFClientResource[6], mQQCFClientResource[7], mQQCFClientResource[8])

#MQQueues
for mQQueueResource in MQQueueResources:
    adminJMSLocal.createMQQueue(mQQueueResource[0], mQQueueResource[1], mQQueueResource[2], mQQueueResource[3], mQQueueResource[4])

#NameSpaceBindings
for NameSpaceBinding in NameSpaceBindings:
    adminJMSLocal.createNameSpaceBindings(NameSpaceBinding[0], NameSpaceBinding[1], NameSpaceBinding[2], NameSpaceBinding[3])

######### Saving configuration ############
print "     Saving configuration."
AdminConfig.save()
#8894
print "     Done."